home *** CD-ROM | disk | FTP | other *** search
- /*
- -*++ class Cheb_vector: Vector in Chebyshev space
- **
- ** (*++ history:
- ** 17 Dec 87 Bruce Eckel Creation date
- ** ++*)
- **
- ** (*++ detailed:
- ** ++*)
- */
-
- class phys_vector; /* forward reference */
-
- class Cheb_vector : public ColVec {
- public:
- Cheb_vector() : () {;}
- Cheb_vector(int n) : (n) {;}
- Cheb_vector(int n, double v) : (n,v) {;}
- Cheb_vector(Cheb_vector & x) { *this = x;}
- phys_vector & physical(); /* transform to physical space */
- Cheb_vector & prime(); /* the derivative */
- /* stuff used inside the functions: (for clarity) */
- /* Chebyshev polynomial: */
- double T(int n, double x) { return cos(n * acos(x)); }
- /* increments over physical space: */
- double dx();
- /* Value of indep variable in physical space: */
- double X(int i) { return (i-1)*dx() -1;}
- /* Oceanography "C" function:*/
- double C(int n) { return n==0? 2 : n > 0 ? 1 : -1; }
- Cheb_vector & operator=(Cheb_vector & rval)
- {//cout << "before assignment\n";
- //cout << (matrix)rval;
- (matrix &)(*this) = (matrix &)rval;
- //cout << "after assignment " << (*this); cout.flush();
- return (*this); }
- Cheb_vector & operator+(Cheb_vector & arg);
- Cheb_vector & operator-(Cheb_vector & arg);
- Cheb_vector & operator*(double & arg);
- friend Cheb_vector & operator*(double & arg1, Cheb_vector & arg2)
- { return arg2 * arg1; } /* for commutativity */
- };
-
- /*
- -*++ class phys_vector: Vector in physical space
- **
- ** (*++ history:
- ** 17 Dec 87 Bruce Eckel Creation date
- ** ++*)
- **
- ** (*++ detailed:
- ** ++*)
- */
-
- class phys_vector : public ColVec {
- public:
- phys_vector() : () {;}
- phys_vector(int n) : (n) {;}
- phys_vector(int n, double v) : (n,v) {;}
- phys_vector(phys_vector & x) : (x) {;}
- Cheb_vector & Chebyshev(); /* transform to Chebyshev space */
- phys_vector & operator=(phys_vector & rval)
- { (matrix &)(*this) = (matrix &)rval; return (*this); }
- };